import { EventService } from 'src/app/shared/service/event.service';
import { Component, OnInit, Input, EventEmitter } from '@angular/core';

@Component({
  selector: 'app-recommend-choose-all',
  templateUrl: './recommend-choose-all.component.html',
  styleUrls: ['./recommend-choose-all.component.scss'],
})
export class RecommendChooseAllComponent implements OnInit {
  @Input() tagData: any;
  checked = false;

  constructor(
    private eventService: EventService
  ) { }

  ngOnInit() {
    this.eventService.eventEmit.on('recommendAllResult', res => {
        this.checked = res;
    });
  }
  // 立即推荐
  recommend() {
    this.eventService.eventEmit.emit('recommendNow', true);
  }
  // 全选
  choose() {
    this.checked = !this.checked;
    this.eventService.eventEmit.emit('recommendCheckedAll', this.checked);
  }
}
